const fs = require('fs');

//原生
// fs.readFile('../resources/content.txt',(err,data) => {
//     if(err) throw err;
//     console.log(data.toString())
// })

//promise
const p = new Promise((resolve, reject) => {
    fs.readFile('../resources/content.txt', (err, data) => {
        if (err) reject(err);
        resolve(data.toString());
    })
});

p.then(data => {
    console.log(data);
}, err => {
    console.log(err);
})